<HTML>
<HEAD>
<TITLE>[Chapter 19] GridBagConstraints</TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:13:24 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_27.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 19<br>java.awt Reference</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch19_29.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>GridBagConstraints</H1>

<H2>Name</H2>

GridBagConstraints

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch19-REFSECT1-AUTOID.28"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/gridbag.gif" alt="[Graphic: Figure from the text]" width=502 height=71 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-1">Description</A></h2>

<P CLASS=para>
The <tt CLASS=literal>GridBagConstraints</tt> class 
provides the means to control the layout of components within a <tt CLASS=literal>Container</tt> 
whose <tt CLASS=literal>LayoutManager</tt> is <tt CLASS=literal>GridBagLayout</tt>. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-2">Class Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.awt.GridBagConstraints
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable {
  
  // Constants
  public final static int BOTH;
  public final static int CENTER;
  public final static int EAST;
  public final static int HORIZONTAL;
  public final static int NONE;
  public final static int NORTH;
  public final static int NORTHEAST;
  public final static int NORTHWEST;
  public final static int RELATIVE;
  public final static int REMAINDER;
  public final static int SOUTH;
  public final static int SOUTHEAST;
  public final static int SOUTHWEST;
  public final static int VERTICAL;
  public final static int WEST;
  
  // Variables
  public int anchor;
  public int fill;
  public int gridheight;
  public int gridwidth;
  public int gridx;
  public int gridy;
  public Insets insets;
  public int ipadx;
  public int ipady;
  public double weightx
  public double weighty
  
  // Constructors
  public GridBagConstraints();
  
  // Instance Methods
  public Object clone();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3">Constants</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.1">BOTH</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.1.1">public final static int BOTH</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>fill</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.2">CENTER</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.2.1">public final static int CENTER</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.3">EAST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.3.1">public final static int EAST</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.4">HORIZONTAL</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.4.1">public final static int HORIZONTAL</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>fill</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.5">NONE</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.5.1">public final static int NONE</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>fill</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.6">NORTH</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.6.1">public final static int NORTH</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.7">NORTHEAST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.7.1">public final static int NORTHEAST</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.8">NORTHWEST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.8.1">public final static int NORTHWEST</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.9">RELATIVE</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.9.1">public final static int RELATIVE</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>gridx</tt>, 
<tt CLASS=literal>gridy</tt>, <tt CLASS=literal>gridwidth</tt>, 
or <tt CLASS=literal>gridheight</tt> value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.10">REMAINDER</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.10.1">public final static int REMAINDER</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>gridwidth</tt> 
or <tt CLASS=literal>gridheight</tt> value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.11">SOUTH</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.11.1">public final static int SOUTH</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.12">SOUTHEAST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.12.1">public final static int SOUTHEAST</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.13">SOUTHWEST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.13.1">public final static int SOUTHWEST</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.14">VERTICAL</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.14.1">public final static int VERTICAL</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>fill</tt> 
value. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.15">WEST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-3.15.1">public final static int WEST</A></h4>

<P CLASS=para>
Constant for possible <tt CLASS=literal>anchor</tt> 
value. 

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4">Variables</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.1">anchor</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.1.1">public int anchor</A></h4>

<P CLASS=para>
Specifies the alignment of the component in the event that it is smaller 
than the space allotted for it by the layout manager; e.g., <tt CLASS=literal>CENTER</tt> 
centers the object within the region. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.2">fill</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.2.1">public int fill</A></h4>

<P CLASS=para>
The component's resize policy if additional space available. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.3">gridheight</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.3.1">public int gridheight</A></h4>

<P CLASS=para>
Number of columns a component occupies. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.4">gridwidth</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.4.1">public int gridwidth</A></h4>

<P CLASS=para>
Number of rows a component occupies. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.5">gridx</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.5.1">public int gridx</A></h4>

<P CLASS=para>
Horizontal grid position at which to add component. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.6">gridy</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.6.1">public int gridy</A></h4>

<P CLASS=para>
Vertical grid position at which to add component. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.7">insets</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.7.1">public Insets insets</A></h4>

<P CLASS=para>
Specifies the outer padding around the component. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.8">ipadx</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.8.1">public int ipadx</A></h4>

<P CLASS=para>
Serves as the internal padding within the component in both the right and 
left directions. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.9">ipady</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.9.1">public int ipady</A></h4>

<P CLASS=para>
Serves as the internal padding within the component in both the top and 
bottom directions. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.10">weightx</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.10.1">public double weightx</A></h4>

<P CLASS=para>
Represents the percentage of extra horizontal space that will be given 
to this component if there is additional space available within the container. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.11">weighty</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-4.11.1">public double weighty</A></h4>

<P CLASS=para>
Represents the percentage of extra vertical space that will be given to 
this component if there is additional space available within the container. 

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-5">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-5.1">GridBagConstraints</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-5.1.1">public GridBagConstraints()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>GridBagConstraints</tt> 
object. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-6">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-6.1">clone</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-6.1.1">public Object clone()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A new instance of <tt CLASS=literal>GridBagConstraints</tt> 
with same values for constraints. 

<p>
<DT CLASS=varlistentry>Overrides <br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.clone()</tt> </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="JAWT-CH-19-REF-GRIDBAGC-SECT-7">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>Cloneable</tt>, <tt CLASS=literal>GridBagLayout</tt>, 
<tt CLASS=literal>Insets</tt>, <tt CLASS=literal>Object</tt>, 
<tt CLASS=literal>Serializable</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_27.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch19_29.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>Graphics</td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>GridBagLayout</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
